﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nage.Examples.Rastrigin.Solution;
using Nage.Algorithms.RastriginIsland;
using Nage.Examples.Rastrigin.Population;
using Nage.Algorithms.Stop;
using Nage.Examples.Rastrigin.Evolution;
using Nage.Examples.RastriginIsland.Topologies;

namespace Nage.Examples.RastriginIsland
{
    public class RastriginProblemIsland : IslandGeneticAlgorithm<Coordinates>
    {
        public RastriginProblemIsland(int islandsAmount, int populationSize, double mutationRate, double delta, double crossoverRate, int stepCount, int migrateAfter)
        {
            this.NumberOfIslands = islandsAmount;
            PopulationFactory = new CoordinatesPopulationFactory(populationSize);
            SolutionEvaluator = new RastriginFunctionEvaluator();
            StopCondition = new FixedStepsStopCondition(stepCount);
            Evolution = new CoordinatesEvolution(mutationRate, delta, crossoverRate);
            MigrationCondition = new FixedGenerationsMigrationCondition(migrateAfter);
            Topology = new CircleTopology<Coordinates>(new Migrator());
        }
    }
}
